package cn.stylefeng.guns.cloud.workflow.modular.model.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.activiti.engine.repository.ProcessDefinition;

import java.io.Serializable;

/**
 * 流程定义结果实体
 *
 * @Author xuyuxiang
 * @Date 2019/11/14 14:37
 **/
@Data
@ApiModel
public class DeployProcessResult implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 流程定义id
     */
    @ApiModelProperty("流程定义id")
    private String id;

    /**
     * 种类
     */
    @ApiModelProperty("种类")
    private String category;

    /**
     * 流程名称
     */
    @ApiModelProperty("流程名称")
    private String name;

    /**
     * 流程定义Key
     */
    @ApiModelProperty("流程定义Key")
    private String key;

    /**
     * 描述
     */
    @ApiModelProperty("描述")
    private String description;

    /**
     * 版本
     */
    @ApiModelProperty("版本")
    private int version;

    /**
     * 流程资源名称(xml)
     */
    @ApiModelProperty("流程资源名称(xml)")
    private String resourceName;

    /**
     * 流程部署id
     */
    @ApiModelProperty("流程部署id")
    private String deploymentId;

    /**
     * 流程图资源名称(png)
     */
    @ApiModelProperty("流程图资源名称(png)")
    private String diagramResourceName;

    /**
     * 是否有开始事件表单
     */
    @ApiModelProperty("是否有开始事件表单")
    private boolean hasStartFormKey;

    /**
     * 是否有图形信息
     */
    @ApiModelProperty("是否有图形信息")
    private boolean hasGraphicalNotation;

    /**
     * 是否挂起
     */
    @ApiModelProperty("是否挂起")
    private boolean isSuspended;

    /**
     * 租户id
     */
    @ApiModelProperty("租户id")
    private String tenantId;

    /**
     * 有参构造
     */
    public DeployProcessResult(ProcessDefinition p) {

        this.id = p.getId();

        this.category = p.getCategory();

        this.name = p.getName();

        this.key = p.getKey();

        this.description = p.getDescription();

        this.version = p.getVersion();

        this.resourceName = p.getResourceName();

        this.deploymentId = p.getDeploymentId();

        this.diagramResourceName = p.getDiagramResourceName();

        this.hasStartFormKey = p.hasStartFormKey();

        this.hasGraphicalNotation = p.hasGraphicalNotation();

        this.isSuspended = p.isSuspended();

        this.tenantId = p.getTenantId();

    }
}
